﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SaintWinControl
{
    public partial class ucLblText : ControlMatrix //UserControl
    {
        [Category("SaintWinControl")]
        [Description("設定顯示文字")]
        public string Caption
        {
            set
            {
                ucLabel1.Caption = value;
            }
            get
            {
                return ucLabel1.Caption;
            }
        }

        [Category("SaintWinControl")]
        [Description("取得和設定Textbox.Text")]
        public string Text
        {
            set
            {
                textBox1.Text = value;
            }
            get
            {
                return textBox1.Text;
            }
        }

        [Category("SaintWinControl")]
        [Description("取得和設定Textbox.Text")]
        public string TextBoxText
        {
            set
            {
                textBox1.Text = value;
            }
            get
            {
                return textBox1.Text;
            }
        }

        [Category("SaintWinControl")]
        [Description("重新設定高度")]
        public int TextBoxHeight
        {
            set
            {
                textBox1.Height = value;
            }
            get
            {
                return textBox1.Height;
            }
        }

        [Category("SaintWinControl")]
        [Description("重新設定可以輸入的長度")]
        public int TextLength
        {
            set
            {
                textBox1.MaxLength = value;
            }
            get
            {
                return textBox1.MaxLength;
            }
        }

        [Category("SaintWinControl")]
        [Description("設定TextBox 是否可以多行輸入")]
        public bool Multiline
        {
            set
            {
                textBox1.Multiline = value;
            }
            get
            {
                return textBox1.Multiline;
            }
            
        }

        [Category("SaintWinControl")]
        [Description("輸入密碼顯示字元")]
        public char PasswordChar
        {
            set
            {
                textBox1.PasswordChar = value;
            }
            get
            {
                return textBox1.PasswordChar;
            }
        }

        
        protected Font textBoxFont = null;

        [Category("SaintWinControl")]
        [Description("設定TextBox Font")]
        public Font TextBoxFont
        {
            set
            {
                textBox1.Font = value;
                textBoxFont = value;
            }

            get
            {
                return textBoxFont == null 
                    ?textBox1.Font:textBoxFont;
            }
        }

        public ucLblText()
        {
            InitializeComponent();
            accessControl = textBox1;
        }


    }
}
